﻿using MathLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Text;

namespace ServiceHost
{
    class Program
    {
        static void Main(string[] args)
        {
            Uri baseUri = new Uri("http://localhost:1024/OmerServices/MathOperationService");

            System.ServiceModel.ServiceHost svc = new System.ServiceModel.ServiceHost(typeof(MathOperation), baseUri);
            svc.AddServiceEndpoint(typeof(IMathOperation), new BasicHttpBinding(), baseUri);
            //svc.AddServiceEndpoint("mex", new mexHttpBinding(), baseUri);

            //proxy üretebilmek için..
            ServiceMetadataBehavior metadataBehav = new ServiceMetadataBehavior();

            metadataBehav.HttpGetEnabled = true;

            svc.Description.Behaviors.Add(metadataBehav);

            Console.WriteLine("Servis açılıyor");
            svc.Open();
            Console.WriteLine("Servis açıldı. "+svc.State);

            Console.Read();
        }
    }
}
